package com.fr.report.io.xml;

import com.fr.report.Report;
import com.fr.report.ReportSettings;
import com.fr.report.TemplateWorkBook;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

public class SynchronizedReportSettings
{
  private static Hashtable threadReportSettingsHash = new Hashtable();
  private TemplateWorkBook wbTpl;
  private ReportSettings reportSettings;

  private SynchronizedReportSettings(TemplateWorkBook paramTemplateWorkBook, ReportSettings paramReportSettings)
  {
    this.wbTpl = paramTemplateWorkBook;
    this.reportSettings = paramReportSettings;
  }

  public TemplateWorkBook getWbTpl()
  {
    return this.wbTpl;
  }

  public void setWbTpl(TemplateWorkBook paramTemplateWorkBook)
  {
    this.wbTpl = paramTemplateWorkBook;
  }

  public ReportSettings getReportSettings()
  {
    return this.reportSettings;
  }

  public void setReportSettings(ReportSettings paramReportSettings)
  {
    this.reportSettings = paramReportSettings;
  }

  public static void putSynchronizedReportSettings(TemplateWorkBook paramTemplateWorkBook, ReportSettings paramReportSettings)
  {
    if ((paramTemplateWorkBook == null) || (paramReportSettings == null))
      return;
    Object localObject = (List)threadReportSettingsHash.get(Thread.currentThread());
    if (localObject != null)
    {
      ((List)localObject).add(new SynchronizedReportSettings(paramTemplateWorkBook, paramReportSettings));
    }
    else
    {
      localObject = new ArrayList(6);
      ((List)localObject).add(new SynchronizedReportSettings(paramTemplateWorkBook, paramReportSettings));
      threadReportSettingsHash.put(Thread.currentThread(), localObject);
    }
  }

  public static void flushSynchronizedReportSettings()
  {
    int i;
    List localList = (List)threadReportSettingsHash.remove(Thread.currentThread());
    if (localList != null)
      for (i = 0; i < localList.size(); ++i)
      {
        int j;
        SynchronizedReportSettings localSynchronizedReportSettings = (SynchronizedReportSettings)localList.get(i);
        if (localSynchronizedReportSettings != null)
          for (j = 0; j < localSynchronizedReportSettings.getWbTpl().getReportCount(); ++j)
            localSynchronizedReportSettings.getWbTpl().getReport(j).setReportSettings(localSynchronizedReportSettings.getReportSettings());
      }
  }

  public static void clear()
  {
    threadReportSettingsHash.clear();
  }
}